/*
https://leetcode-cn.com/problems/escape-the-ghosts/solution/tao-tuo-zu-ai-zhe-by-leetcode-solution-gjga/
 */

public class Solution789 {
    public int dis(int a,int b,int x,int y){
        return Math.abs(x-a)+Math.abs(y-b);
    }
    public boolean escapeGhosts(int[][] ghosts, int[] target) {
        int max=dis(target[0],target[1],0,0);
        for (int i=0;i<ghosts.length;i++){
            int d=dis(target[0],target[1],ghosts[i][0],ghosts[i][1]);
            if (d<=max){
                return false;
            }
        }
        return true;
    }

    public static void main(String[] args) {
        System.out.println(new Solution789().escapeGhosts(new int[][]{{1,0},{0,3}},new int[]{0,1}));
    }
}
